home *** CD-ROM | disk | FTP | other *** search
/ .net (French) 1996 November / .net Magazine (FR) - Issue 01 - Nov 1996.iso / mac / Edition Web / PageSpinner 1.2b2 / JavaScript Examples / Scrolling Text Stationery < prev    next >
Text File  |  1996-06-05  |  3KB  |  94 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE>JavaScript Scrolling Text</TITLE>
  4.  
  5. <SCRIPT LANGUAGE="JavaScript">
  6. <!-- Beginning of JavaScript -----
  7. /* 
  8.    WARNING! This script example contains an error that may cause 
  9.          Netscape to crash on certain systems. Use the script with care!
  10.  
  11.     Copyright (C)1996 Web Integration Systems, Inc. DBA Websys, Inc.
  12.        All Rights Reserved.
  13.  
  14.     This applet can be re-used or modified, if credit is given in 
  15.     the source code. We will not be held responsible for any unwanted 
  16.     effects due to the usage of this applet or any derivative.  
  17.     No warrantees for usability for any specific application are given
  18.      or implied.
  19.  
  20.     Chris Skinner, January 30th, 1996.
  21.     Hacked for CNNfn by RD, Jan. 31, 1996
  22. */
  23.  
  24. function scrollit(seed)
  25. {
  26.     var m1  = "This is an axemple of scrolling text using JavaScript";
  27.     var m2  = " . . . you can put your own message here to get attention";
  28.     var m3  = " . . . Please enjoy PageSpinner! ";
  29.     
  30.     var msg=m1+m2+m3;
  31.     var out = " ";
  32.     var c   = 1;
  33.  
  34.     if (seed > 100) {
  35.         seed--;
  36.         var cmd="scrollit(" + seed + ")";
  37.         timerTwo=window.setTimeout(cmd,100);
  38.     }
  39.     else if (seed <= 100 && seed > 0) {
  40.         for (c=0 ; c < seed ; c++) {
  41.             out+=" ";
  42.         }
  43.         out+=msg;
  44.         seed--;
  45.         var cmd="scrollit(" + seed + ")";
  46.             window.status=out;
  47.         timerTwo=window.setTimeout(cmd,100);
  48.     }
  49.     else if (seed <= 0) {
  50.         if (-seed < msg.length) {
  51.             out+=msg.substring(-seed,msg.length);
  52.             seed--;
  53.             var cmd="scrollit(" + seed + ")";
  54.             window.status=out;
  55.             timerTwo=window.setTimeout(cmd,100);
  56.         }
  57.         else {
  58.             window.status=" ";
  59.             timerTwo=window.setTimeout("scrollit(100)",75);
  60.         }
  61.     }
  62. }
  63. // -- End of JavaScript code -------------- -->
  64. </SCRIPT>
  65.  
  66. </HEAD>
  67.  
  68. <BODY onLoad="timerONE=window.setTimeout('scrollit(100)',500);">
  69.  
  70. <H1>JavaScript Scrolling Text</H1>
  71.  
  72. <B>This stationary page contains a Java that displays a scrolling message in the status area in Netscape Navigator 2.0. </B>
  73. <P>
  74. <FONT COLOR="DD0000">
  75. <PRE>WARNING! This script example contains an error that may cause 
  76. Netscape to crash on certain systems. Use the script with care!
  77. </PRE>
  78. </FONT>
  79.  
  80. The script is named <B>scrollit</B> and it is placed in the HEAD section of the HTML document.  It is executed inside the BODY start tag:
  81.  
  82. <XMP><BODY onLoad="timerONE=window.setTimeout('scrollit(100)',500);"></XMP>
  83.  
  84. Replace the text inside the script with your own message and edit the page or copy the entire script to an existing page:
  85. <XMP>function scrollit(seed)
  86. {
  87. var m1  = "This is an axemple of scrolling text using JavaScript";
  88. var m2  = " . . . you can put your own message here to get attention";
  89. var m3  = " . . . Please enjoy PageSpinner! ";</XMP>
  90. <HR>
  91.  
  92. </BODY>
  93. </HTML>
  94.